home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_218 / maze / about.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  8KB  |  236 lines

  1. #include <exec/types.h>
  2. #include <graphics/view.h>
  3. #include <intuition/intuition.h>
  4. #include <functions.h>
  5. #include <libraries/dos.h>
  6. #include <libraries/dosextens.h>
  7.  
  8. extern struct Window *window;
  9. extern ULONG RangeRand();
  10. extern struct TextAttr font;
  11.  
  12. cycle(color) int color;
  13. {   struct ColorMap *cm;
  14.     struct ViewPort *vp;
  15.     UWORD orig, r, g, b, ro, go, bo;
  16.     int i;
  17.  
  18.     vp = ViewPortAddress( window );
  19.     cm = vp -> ColorMap;
  20.  
  21.     orig = GetRGB4( cm, (LONG) color );
  22.     b = (bo = (orig     ) & 15);
  23.     g = (go = (orig >> 4) & 15);
  24.     r = (ro = (orig >> 8) & 15);
  25.  
  26.     for (i=0; i<1000; i++) {
  27.         r = RangeRand(2L) * 15;
  28.         g = RangeRand(2L) * 15;
  29.         b = RangeRand(2L) * 15;
  30.         SetRGB4(vp,(LONG)color,(LONG)r,(LONG)g,(LONG)b);
  31.         }
  32.     SetRGB4(vp,(LONG)color,(LONG)ro,(LONG)go,(LONG)bo);
  33.     }
  34.  
  35. #define reqW  544
  36. #define reqH  152
  37. #define centerX(chars) (reqW/2 - (chars)*8/2)
  38. #define centerXright(chars) (reqW - 111 - (chars)*8/2)
  39. #define centerXleft(chars) (111 - (chars)*8/2)
  40.  
  41. SHORT reqborderXY[] = { 2,1, 541,1, 541,150, 2,150, 2,1 };
  42.  
  43. struct Border reqborder = {
  44.         0,0,        /* LeftEdge, TopEdge */
  45.         1,1,        /* FrontPen, BackPen */
  46.         JAM1,       /* DrawMode */
  47.         5,          /* Count */
  48.         reqborderXY,/* SHORT *XY */
  49.         NULL,       /* NextBorder */
  50.         };
  51.  
  52. SHORT gadborderXY[] = { 2,1, 97,1, 97,28, 2,28, 2,1 };
  53.  
  54. struct Border gadborder = {
  55.         2,1,        /* LeftEdge, TopEdge */
  56.         1,2,        /* FrontPen, BackPen */
  57.         JAM2,       /* DrawMode */
  58.         5,          /* Count */
  59.         gadborderXY,   /* SHORT *XY */
  60.         NULL,       /* NextBorder */
  61.         };
  62.  
  63. struct IntuiText gadtext = {
  64.         1,2,      /* FrontPen, BackPen */
  65.         JAM1,     /* DrawMode */
  66.         18,11,    /* LeftEdge, TopEdge */
  67.         &font,     /* TextAttr *ITextFont */
  68.         (UBYTE *) "Continue", /* IText */
  69.         NULL,     /* struct IntuiText *NextText */
  70.         };
  71.  
  72. struct Gadget aboutgad = {
  73.         NULL,          /* NextGadget */
  74.         222,117,100,30,  /* LeftEdge, TopEdge, Width, Height */
  75.         GADGHNONE,         /* Flags */
  76.         ENDGADGET | TOGGLESELECT,  /* Activation Flags */
  77.         REQGADGET | BOOLGADGET, /* GadgetType */
  78.         (APTR)&gadborder,       /* GadgetRender */
  79.         NULL,       /* SelectRender */
  80.         &gadtext,       /* GadgetText   */
  81.         NULL,       /* MutualExclude */
  82.         NULL,       /* SpecialInfo  */
  83.         0,          /* GadgetID     */
  84.         NULL,       /* UserData     */
  85.         };
  86.  
  87. struct IntuiText  ab_txt8= {
  88.         3,2,    /* FrontPen, BackPen */
  89.         JAM1,   /* DrawMode */
  90.         20,102,    /* LeftEdge, TopEdge */
  91.         &font,   /* TextAttr *ITextFont */
  92.         (UBYTE *) "Comments and suggestions are welcome.", /* IText */
  93.         NULL,   /* struct IntuiText *NextText */
  94.         };
  95. struct IntuiText  ab_txt7= {
  96.         3,2,    /* FrontPen, BackPen */
  97.         JAM1,   /* DrawMode */
  98.         20,92,    /* LeftEdge, TopEdge */
  99.         &font,   /* TextAttr *ITextFont */
  100.         (UBYTE *) "writing it.  Please feel free to share it with your friends.", /* IText */
  101.         &ab_txt8,   /* struct IntuiText *NextText */
  102.         };
  103. struct IntuiText  ab_txt6= {
  104.         3,2,    /* FrontPen, BackPen */
  105.         JAM1,   /* DrawMode */
  106.         20,82,    /* LeftEdge, TopEdge */
  107.         &font,   /* TextAttr *ITextFont */
  108.         (UBYTE *) "   I hope you enjoy playing this game as much as I enjoyed", /* IText */
  109.         &ab_txt7,   /* struct IntuiText *NextText */
  110.         };
  111. struct IntuiText  ab_inst3= {
  112.         3,2,    /* FrontPen, BackPen */
  113.         JAM1,   /* DrawMode */
  114.         20,68,    /* LeftEdge, TopEdge */
  115.         &font,   /* TextAttr *ITextFont */
  116.         (UBYTE *) "give you a hint.  Select new mazes from the menu.  Good luck!", /* IText */
  117.         &ab_txt6,   /* struct IntuiText *NextText */
  118.         };
  119. struct IntuiText  ab_inst2= {
  120.         3,2,    /* FrontPen, BackPen */
  121.         JAM1,   /* DrawMode */
  122.         20,59,    /* LeftEdge, TopEdge */
  123.         &font,   /* TextAttr *ITextFont */
  124.         (UBYTE *) "red spot to the dark red spot.  The left mouse button will", /* IText */
  125.         &ab_inst3,   /* struct IntuiText *NextText */
  126.         };
  127. struct IntuiText  ab_inst1= {
  128.         3,2,    /* FrontPen, BackPen */
  129.         JAM1,   /* DrawMode */
  130.         20,50,    /* LeftEdge, TopEdge */
  131.         &font,   /* TextAttr *ITextFont */
  132.         (UBYTE *) "   Move the mouse pointer through the maze from the bright", /* IText */
  133.         &ab_inst2,   /* struct IntuiText *NextText */
  134.         };
  135. struct IntuiText  ab_left2= {
  136.         3,2,    /* FrontPen, BackPen */
  137.         JAM1,   /* DrawMode */
  138.         centerXleft(19),120,    /* LeftEdge, TopEdge */
  139.         &font,   /* TextAttr *ITextFont */
  140.         (UBYTE *) "Usenet Distribution", /* IText */
  141.         &ab_inst1,   /* struct IntuiText *NextText */
  142.         };
  143. struct IntuiText  ab_left1= {
  144.         3,2,    /* FrontPen, BackPen */
  145.         JAM1,   /* DrawMode */
  146.         centerXleft(12),130,    /* LeftEdge, TopEdge */
  147.         &font,   /* TextAttr *ITextFont */
  148.         (UBYTE *) "Spring, 1989", /* IText */
  149.         &ab_left2,   /* struct IntuiText *NextText */
  150.         };
  151. struct IntuiText  ab_txt5= {
  152.         3,2,    /* FrontPen, BackPen */
  153.         JAM1,   /* DrawMode */
  154.         centerXright(24),140,    /* LeftEdge, TopEdge */
  155.         &font,   /* TextAttr *ITextFont */
  156.         (UBYTE *) "utoddl@ecsvax.uncecs.edu", /* IText */
  157.         &ab_left1,   /* struct IntuiText *NextText */
  158.         };
  159. struct IntuiText  ab_txt4= {
  160.         3,2,    /* FrontPen, BackPen */
  161.         JAM1,   /* DrawMode */
  162.         centerXright(20),130,    /* LeftEdge, TopEdge */
  163.         &font,   /* TextAttr *ITextFont */
  164.         (UBYTE *) "utoddl@ecsvax.BITNET", /* IText */
  165.         &ab_txt5,   /* struct IntuiText *NextText */
  166.         };
  167. struct IntuiText  ab_txt3= {
  168.         3,2,    /* FrontPen, BackPen */
  169.         JAM1,   /* DrawMode */
  170.         centerXright(21),120,    /* LeftEdge, TopEdge */
  171.         &font,   /* TextAttr *ITextFont */
  172.         (UBYTE *) "Author: Todd M. Lewis", /* IText */
  173.         &ab_txt4,   /* struct IntuiText *NextText */
  174.         };
  175. struct IntuiText  ab_txt2= {
  176.         3,2,    /* FrontPen, BackPen */
  177.         JAM1,   /* DrawMode */
  178.         centerX(32),35,    /* LeftEdge, TopEdge */
  179.         &font,   /* TextAttr *ITextFont */
  180.         (UBYTE *) "The Disk Magazine for the Amiga.", /* IText */
  181.         &ab_txt3,   /* struct IntuiText *NextText */
  182.         };
  183. struct IntuiText  ab_txt1= {
  184.         3,2,    /* FrontPen, BackPen */
  185.         JAM1,   /* DrawMode */
  186.         centerX(30),25,    /* LeftEdge, TopEdge */
  187.         &font,   /* TextAttr *ITextFont */
  188.         (UBYTE *) "First distributed on JUMPDISK,", /* IText */
  189.         &ab_txt2,   /* struct IntuiText *NextText */
  190.         };
  191. struct IntuiText  ab_txt0= {
  192.         3,2,    /* FrontPen, BackPen */
  193.         JAM1,   /* DrawMode */
  194.         centerX(33),15,    /* LeftEdge, TopEdge */
  195.         &font,   /* TextAttr *ITextFont */
  196.         (UBYTE *) "Copyright (c) 1988, Todd M. Lewis", /* IText */
  197.         &ab_txt1,   /* struct IntuiText *NextText */
  198.         };
  199. struct IntuiText firsttext = {
  200.         3,2,    /* FrontPen, BackPen */
  201.         JAM1,   /* DrawMode */
  202.         centerX(27),6,    /* LeftEdge, TopEdge */
  203.         &font,   /* TextAttr *ITextFont */
  204.         (UBYTE *) "TML's AmigaMaze version 1.2", /* IText */
  205.         &ab_txt0,   /* struct IntuiText *NextText */
  206.         };
  207.  
  208. struct Requester aboutreq;
  209.  
  210. about()
  211. {   struct IntuiMessage *msg;
  212.     int class;
  213.  
  214.     InitRequester( &aboutreq );
  215.  
  216.     aboutreq.LeftEdge   = 4;
  217.     aboutreq.TopEdge    = 15;
  218.     aboutreq.Width      = reqW;
  219.     aboutreq.Height     = reqH;
  220.     aboutreq.ReqGadget  = &aboutgad;
  221.     aboutreq.ReqText    = &firsttext;
  222.     aboutreq.ReqBorder  = &reqborder;
  223.     aboutreq.BackFill   = 2;      /* BLACK */
  224.  
  225.     if (Request( &aboutreq, window )) {
  226.        do {
  227.              Wait( 1L << window->UserPort->mp_SigBit );
  228.              while (msg = (struct IntuiMessage *)GetMsg( window->UserPort )) {
  229.                  class = msg->Class;
  230.                  ReplyMsg(msg);
  231.                  }
  232.              } while ( class != REQCLEAR );
  233.        }
  234.    }
  235.  
  236.